import {
  ShapeCustomizationManagementModel,
  ShapeStyleValue
} from "@/modules/model/modals/shapeCustomization/ShapeCustomizationManagementModel";
import { markRaw } from "vue";
import ImageBoxComps from "@/modules/model/modals/shapeCustomization/comps/valueComps/ImageBoxComps.vue";

export const valueCompsMap = {
  imagebox: markRaw(ImageBoxComps)
};

export const shapeStyleInfo: ShapeStyleValue[] = [
  {
    enName: "Image box",
    enTips: "",
    key: "imagebox",
    name: "图片",
    value: null
  }
];

export class ShapeImageBoxModel {
  shapeStyleInfo = shapeStyleInfo;

  constructor(public shapeCustomizationManagementModel: ShapeCustomizationManagementModel) {}

  initImageBoxConfig(row) {
    this.shapeStyleInfo[0].value = row;
  }

  updateValue(imgUrl: string, key: string) {
    const targetRow = this.shapeStyleInfo.find(item => item.key === key);
    if (targetRow) targetRow.value = imgUrl;
  }
}
